Created: 2022-10-03
Because the DOM is where your CSS and the document's content meet up.
When you start working with browser DevTools
you will be navigating the DOM as you select items in order to see which rules apply.
Original HTML
<p>
Let's use:
<span>Cascading</span>
<span>Style</span>
<span>Sheets</span>
</p>
This below is the DOM Tree
P
├─ "Let's use:"
├─ SPAN
| └─ "Cascading"
├─ SPAN
| └─ "Style"
└─ SPAN
└─ "Sheets"
If we apply a css to that HTML
span {
border: 1px solid black;
background-color: lime;
}
This is how it applies HTML and CSS to the DOM
span selector, It applies that to each one of the three <span>s,